<%--
  Created by IntelliJ IDEA.
  User: 86198
  Date: 2022/5/27
  Time: 14:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<style>
    table{
        border: 1px solid lightblue;
        width: 1000px;
        margin: 10px auto;
        text-align: center;
        border-collapse: collapse;
    }
    tr{
        border: 1px solid lightblue;
        height:50px;
        text-align: center;
    }
    td,th{
        border: 1px solid lightblue;
    }
    h2{
        text-align:center;
    }
</style>
</head>
<body>
<h2>图书列表</h2>
<p>欢迎【${username}】</p>
<table>
    <tr>
        <th>编码</th>
        <th>书名</th>
        <th>作者</th>
        <th>简介</th>
        <th>出版商</th>
        <th>价格</th>
        <th colspan="3">操作</th>
    </tr>
    <c:forEach items="${books}" var="book">
        <tr>

            ?bookId=${book.id}" onclick="return confirm('确定删除？')">删除</a></td>
            <td><a href="upDateBook.jsp?bookId=${book.id}" onclick="return confirm('确定修改？')">修改</a></td>
            <td><a href="addBook.jsp" onclick="return confirm('确定添加其他图书？')">添加其他图书</a></td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="9">
            <a href="<c:url value='/BookServlet?pageIndex=1'></c:url>">首页</a>

            <c:if test="${page.pageIndex > 1 }">
                <a href="<c:url value='/BookServlet?pageIndex=${page.pageIndex-1}'></c:url>">上一页</a>
            </c:if>

            <c:if test="${page.pageIndex<page.totalPages}">
                <a href="<c:url value='/BookServlet?pageIndex=${page.pageIndex+1}'></c:url>">下一页</a>
            </c:if>

            <a href="<c:url value='/BookServlet?pageIndex=${page.totalPages}'></c:url>">尾页</a>
        </td>
    </tr>
</table>
</body>
</html>
